package com.lanou3g.practice;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

/**
 * Created by dllo on 18/4/24.
 */
public class ReadThread extends Thread {

    private Socket socket;

    public ReadThread(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {

        BufferedReader br = null;
        String line = null;
        try {
            br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            while ((line = br.readLine()) != null){

                System.out.println(line);

            }
        } catch (Exception e) {
            e.printStackTrace();
        }finally {


        }




    }
}
